package cn.gzjp.modules.gas.entity;

import cn.hutool.core.date.DateUtil;
import org.hibernate.validator.constraints.Length;

import cn.gzjp.common.persistence.DataEntity;
import cn.gzjp.common.utils.excel.annotation.ExcelField;

import java.math.BigDecimal;
import java.text.DateFormat;
import java.util.Date;

/**
 * 加油订单Entity
 * @author zengcp
 * @version 2018-03-05
 */
public class GasOrder extends DataEntity<GasOrder> {
	
	private static final long serialVersionUID = 1L;
	private String openid;		// openid
	private String nickName;		// 昵称
	private String stationId;		// 加油站
	private String stationName; //加油站名称
	private String categoryId;		// 油类id
	private String categoryName;  //油品名称
	private String gunSn;		// 油枪编号
	private BigDecimal price;		// 价格
	private BigDecimal totalL;		// 加油总量
	private BigDecimal gasSingle;
	private BigDecimal totalM;		// 总金额
	private BigDecimal discountM;  //优惠金额
	private BigDecimal realPayM;  //实际支付
	private int payStatus;		// 支付状态 0未支付 1已支付
	private String  gasway;//加油方式
	private String  wxOrderId;//微信流水id

	private String gasType; //汽油类型

	private BigDecimal amount;  //实际支付

	private BigDecimal moneyTotal;//总金额

	private BigDecimal orderPay;//实际支付


	public BigDecimal getGasSingle() {
		return this.getTotalL();
	}

	public void setGasSingle(BigDecimal gasSingle) {
		this.gasSingle = gasSingle;
	}

	public BigDecimal getOrderPay() {
		return this.getRealPayM();
	}

	public void setOrderPay(BigDecimal orderPay) {
		this.orderPay = orderPay;
	}

	public BigDecimal getMoneyTotal() {
		return this.getTotalM();
	}

	public void setMoneyTotal(BigDecimal moneyTotal) {
		this.moneyTotal = moneyTotal;
	}

	public GasOrder() {
		super();
	}

	public GasOrder(String id){
		super(id);
	}

	public String getGasType() {
		return this.getCategoryName();
	}

	public void setGasType(String gasType) {
		this.gasType = gasType;
	}

	@Length(min=0, max=32, message="openid长度必须介于 0 和 32 之间")
	@ExcelField(title="openid", align=2, sort=1)
	public String getOpenid() {
		return openid;
	}

	public void setOpenid(String openid) {
		this.openid = openid;
	}
	
	@Length(min=0, max=32, message="昵称长度必须介于 0 和 32 之间")
	@ExcelField(title="昵称", align=2, sort=2)
	public String getNickName() {
		return nickName;
	}

	public void setNickName(String nickName) {
		this.nickName = nickName;
	}
	
	@Length(min=0, max=32, message="加油站长度必须介于 0 和 32 之间")
	@ExcelField(title="加油站", align=2, sort=3)
	public String getStationId() {
		return stationId;
	}

	public void setStationId(String stationId) {
		this.stationId = stationId;
	}
	
	@Length(min=0, max=32, message="油类id长度必须介于 0 和 32 之间")
	@ExcelField(title="油类id", align=2, sort=4)
	public String getCategoryId() {
		return categoryId;
	}

	public void setCategoryId(String categoryId) {
		this.categoryId = categoryId;
	}
	
	@Length(min=0, max=12, message="油枪编号长度必须介于 0 和 12 之间")
	@ExcelField(title="油枪编号", align=2, sort=5)
	public String getGunSn() {
		return gunSn;
	}

	public void setGunSn(String gunSn) {
		this.gunSn = gunSn;
	}

	public BigDecimal getPrice() {
		return price;
	}

	public void setPrice(BigDecimal price) {
		this.price = price;
	}

	public BigDecimal getTotalL() {
		return totalL;
	}

	public void setTotalL(BigDecimal totalL) {
		this.totalL = totalL;
	}

	public BigDecimal getTotalM() {
		return totalM;
	}

	public void setTotalM(BigDecimal totalM) {
		this.totalM = totalM;
	}

	@Length(min=0, max=1, message="支付状态长度必须介于 0 和 1 之间")
	@ExcelField(title="支付状态", dictType="pay_status", align=2, sort=9)
	public int getPayStatus() {
		return payStatus;
	}

	public void setPayStatus(int payStatus) {
		this.payStatus = payStatus;
	}


	public String getStationName() {
		return stationName;
	}

	public void setStationName(String stationName) {
		this.stationName = stationName;
	}

	public String getCategoryName() {
		return categoryName;
	}

	public void setCategoryName(String categoryName) {
		this.categoryName = categoryName;
	}

	public BigDecimal getDiscountM() {
		return discountM;
	}

	public void setDiscountM(BigDecimal discountM) {
		this.discountM = discountM;
	}

	public String getMonth(){
		return DateUtil.format(this.getCreateDate(), "yyyy年MM月");
	}

	public String getGasway() {
		return gasway;
	}

	public void setGasway(String gasway) {
		this.gasway = gasway;
	}

	public BigDecimal getRealPayM() {
		return realPayM;
	}

	public void setRealPayM(BigDecimal realPayM) {
		this.realPayM = realPayM;
	}

	public String getWxOrderId() {
		return wxOrderId;
	}

	public void setWxOrderId(String wxOrderId) {
		this.wxOrderId = wxOrderId;
	}

	public BigDecimal getAmount() {
		return this.getRealPayM();
	}

	public void setAmount(BigDecimal amount) {
		this.amount = amount;
	}
}